<?php

/**
 * @author Jeevan Tomson
 * @copyright 2011
 */
    include_once("includes/appdata.php");
    require_once(APP_DIRECTORY."/php/include.php");
    
    $error_msg = "";
    
    $langList = $langMgr->getLanguageList();
    
    if( isset($_POST["btnLogin"]) ) {
        printObject($_POST); exit;
    }
    
    
    
    //printObject($langList); exit;
 
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>PowerMan Login</title>
        
        <link rel="stylesheet" href="<?php echo ROOT_DIR; ?>css/common.css" type="text/css" media="screen" title="default" />
        <link rel="stylesheet" href="<?php echo ROOT_DIR; ?>css/login.css" type="text/css" media="screen" title="default" />
        
        <!--  jquery core -->
        <script src="<?php echo ROOT_DIR; ?>js/jquery-1.5.2.min.js" type="text/javascript"></script>
        <script type="text/javascript" src="<?php echo ROOT_DIR; ?>js/jquery-ui-1.8.12.custom.min.js"></script>
        <script type="text/javascript" src="<?php echo ROOT_DIR; ?>js/jquery.validate.js"></script>
        <script type="text/javascript" src="<?php echo ROOT_DIR; ?>js/jquery.validate.messages.js"></script>
        
        <!-- Custom javascript code -->
        <script type="text/javascript" src="<?php echo ROOT_DIR; ?>js/lib.js"></script>
        <script type="text/javascript" src="<?php echo ROOT_DIR; ?>js/powerman.js"></script>
        
        <script>
            $(document).ready(function () {
            	$(".forgot-pwd").click(function () {
                	$("#loginbox").hide();
                	$("#forgotbox").show();
                	return false;
            	});
            
            	$(".back-login").click(function () {
                	$("#loginbox").show();
                	$("#forgotbox").hide();
                	return false;
            	});
                
                $("#frmLogin").validate({
                    rules: {
                        username: {
                            required: true,
                            minlength: <?php echo USER_NAME_MIN_LENGTH; ?>,
                            maxlength: <?php echo USER_NAME_MAX_LENGTH; ?> 
                        },
                        password: {
                            required: true,
                            minlength: <?php echo PASSWORD_MIN_LENGTH; ?>,
                            maxlength: <?php echo PASSWORD_MAX_LENGTH; ?>
                        }
                    },
                    messages: {
                        username: {
                            required: "<?php label("required_msg"); ?>"
                        },
                        password: {
                            required: "<?php label("required_msg"); ?>"
                        }                    
                    }
                });
            });
        </script>
    </head>
    <body id="login-bg"> 
        
        <!-- Start: login-holder -->
        <div id="login-holder">
            
            <!-- start logo -->
            <div id="logo-login">
                <a href="index.html"><img src="<?php echo ROOT_DIR; ?>images/logo3.png" width="156" height="40" alt="" /></a>
            </div>
            <!-- end logo -->
            
            <div class="clear"></div>
            
            <!--  start loginbox ................................................................................. -->
            <div id="loginbox">
                
                <!--  start login-inner -->
                <div id="login-inner">
                    <div id="loginerror">
                    	<?php echo $error_msg; ?>
                    </div>
                    <form name="frmLogin" id="frmLogin" method="POST">
                        <table border="0" cellpadding="0" cellspacing="0">
                            <tr>
                        		<th><?php label("Username"); ?></th>
                        		<td><input type="text" name="username" class="login-inp" /></td>
                        	</tr>
                        	<tr>
                        		<th><?php label("Password"); ?></th>
                        		<td><input name="password" type="password" value=""  onfocus="this.value=''" class="login-inp" onkeyup="return submitenter(this,event)" /></td>
                        	</tr>
                            <tr>
                        		<th><?php label("Language"); ?></th>
                        		<td>
                                    <div class="login-inp">
                                        <select name="lang" class="login-inp-select">
                                            <?php
                                            foreach($langList as $lang) {
                                            ?>
                                                <option <?php if($user_lang == $lang["id"]) echo "selected"; ?> value="<?php echo $lang["id"]; ?>"><?php echo $lang["value"]; ?></option>
                                            <?php    
                                            }
                                            ?>
                                        </select>
                                    </div>
                                </td>
                        	</tr>
                        	<tr>
                        		<th></th>
                        		<td valign="top">
                                    <input name="remember" type="checkbox" class="checkbox-size" id="login-check" />
                                    <label for="login-check"><?php label("Remember me"); ?></label>
                                </td>
                        	</tr>
                        	<tr>
                        		<th></th>
                        		<td><input type="submit" name="btnLogin" value="Login" class="submit-login"/></td>
                        	</tr>
                        </table>
                    </form>
                </div>
                <!--  end login-inner -->
                <div class="clear"></div>
                <a href="" class="forgot-pwd"><?php label("Forgot Password"); ?></a>
            </div>
            <!--  end loginbox -->
        
            <!--  start forgotbox ................................................................................... -->
            <div id="forgotbox">
            	<div id="forgotbox-text"><?php label("password_reset_msg"); ?></div>
            	<!--  start forgot-inner -->
            	<div id="forgot-inner">
                    <form method="POST" action="login.php">
                        <table border="0" cellpadding="0" cellspacing="0">
                        	<tr>
                        		<th><?php label("Email address"); ?>:</th>
                        		<td><input type="text" value=""   class="login-inp" /></td>
                        	</tr>
                        	<tr>
                        		<th> </th>
                        		<td><input type="button" name="btnForgotPswd" value="Submit" class="submit-login" /></td>
                        	</tr>
               	        </table>
                    </form>
            	</div>
            	<!--  end forgot-inner -->
            	<div class="clear"></div>
            	<a href="" class="back-login">Back to login</a>
            </div>
            <!--  end forgotbox -->
        
        </div>
        <!-- End: login-holder -->
        
    </body>
</html>
<?php

?>
